// Compositor Creators
// (c) jimon game studio

#ifndef JEH_JECOMPOSITORCREATORS
#define JEH_JECOMPOSITORCREATORS

#include "ISceneManager.h"
#include "CDefaultCompositor.h"
#include "CDeferredShadingCompositor.h"
#include "CForwardCompositor.h"

namespace je
{
	namespace scene
	{
		template <class T>
		class CompositorFactoryCreator_DescSceneManager:public ISceneManager::CompositorFactoryType::BaseTypeCreator
		{
		protected:
			scene::ISceneManager * CurrentSceneManager;
		public:
			CompositorFactoryCreator_DescSceneManager(scene::ISceneManager * SceneManager)
				:CurrentSceneManager(SceneManager)
			{
			}
			ICompositor * Create()
			{
				ICompositor * NewCreate = NULL;
				JENEW(NewCreate, T (CurrentSceneManager))
				return NewCreate;
			}
		};

		template<class T>
		void RegisterCompositorType(ISceneManager::CompositorFactoryType * Factory,scene::ISceneManager * SceneManager,const jeStringc & Name)
		{
			ISceneManager::CompositorFactoryType::BaseTypeCreator * Creator = NULL;
			JENEW(Creator,T(SceneManager))
			Factory->RegisterDiscribedClass(Name,Creator);
		}

		#define ADD_COMPOSITOR_FACTORY_TYPE_DS(__Name) typedef CompositorFactoryCreator_DescSceneManager< C##__Name > FactoryCreator_C##__Name ;\
											RegisterCompositorType< FactoryCreator_C##__Name >(Factory,SceneManager, #__Name );

		void RegisterCompositorTypes(ISceneManager::CompositorFactoryType * Factory,scene::ISceneManager * SceneManager)
		{
			ADD_COMPOSITOR_FACTORY_TYPE_DS(DefaultCompositor)
			ADD_COMPOSITOR_FACTORY_TYPE_DS(DeferredShadingCompositor)
			ADD_COMPOSITOR_FACTORY_TYPE_DS(ForwardCompositor)
		}
	}
}

#endif
